# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kdav2
pkgver=0.4.0
pkgrel=3
pkgdesc="DAV protocol implementation with KJobs"
arch="all !armhf" # qtdeclarative
url="https://community.kde.org/KDE_PIM"
license="GPL-2.0-or-later"
depends_dev="
	kcoreaddons5-dev
	qt5-qtbase-dev
	qt5-qtxmlpatterns-dev
	"
makedepends="
	$depends_dev
	extra-cmake-modules
	samurai
	"
subpackages="$pkgname-dev"
#source="https://download.kde.org/unstable/kdav2/$pkgver/src/kdav2-$pkgver.tar.xz"
source="https://invent.kde.org/pim/kdav2/-/archive/v$pkgver/kdav2-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# kdav2-davcollectionfetchjob and kdav2-davcollectioncreatejob require network access
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "kdav2-davcollection(fetch|create)job"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="a0c355c1594dd5cdea3bf7190778ad591bb6d290eee4286492090d685547609ad7efa26657b7c0075ac4aaed2c71e558d1e1fc2d684667bae4dc3ba3cd25dd99  kdav2-v0.4.0.tar.gz"
